/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#include "umc_defs.h"
#if defined(UMC_ENABLE_AVS_VIDEO_DECODER)

#include "umc_avs_dec_decompressor.h"
#include "umc_avs_mb_info.h"

namespace UMC
{

void AVSDecompressor::SetIntraPredModeISlice(AVS_MB_INFO *pLeft,
                                                 AVS_MB_INFO *pTop,
                                                 Ipp32s iBlockNum)
{
    IppIntra8x8PredMode_H264 predIntraPredMode;

    // obtain prediction modes from neighbours
    if ((pLeft) && (pTop))
    {
        IppIntra8x8PredMode_H264 intraPredModeA, intraPredModeB;

        intraPredModeA = pLeft->IntraLumaPredMode[iBlockNum ^ 1];
        intraPredModeB = pTop->IntraLumaPredMode[iBlockNum ^ 2];

        predIntraPredMode = IPP_MIN(intraPredModeA, intraPredModeB);
    }
    else
        predIntraPredMode = IPP_8x8_DC;

    // calculate prediction mode
    if (1 == pred_mode_flag[iBlockNum])
    {
        m_pMbInfo->IntraLumaPredMode[iBlockNum] = predIntraPredMode;
    }
    else
    {
        IppIntra8x8PredMode_H264 predMode;

        predMode = (IppIntra8x8PredMode_H264) intra_luma_pred_mode[iBlockNum];
        if (predMode < predIntraPredMode)
            m_pMbInfo->IntraLumaPredMode[iBlockNum] = predMode;
        else
            m_pMbInfo->IntraLumaPredMode[iBlockNum] = (IppIntra8x8PredMode_H264) (predMode + 1);
    }

} // void AVSDecompressor::SetIntraPredModeISlice(Ipp32s iLeft,

} // namespace UMC

#endif // defined(UMC_ENABLE_AVS_VIDEO_DECODER)
